home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Container Common / htparse.h < prev    next >
Text File  |  1997-01-03  |  3KB  |  127 lines

  1. /*
  2.    This file was derived from the libwww code, version 2.15, from CERN.
  3.    A number of modifications have been made by Spyglass.
  4.  
  5.    eric@spyglass.com
  6.  */
  7.  
  8. /*                                                   HTParse:  URL parsing in the WWW Library
  9.    HTPARSE
  10.  
  11.    This module of the WWW library contains code to parse URLs and various related things.
  12.    Implemented by HTParse.c .
  13.  
  14.  */
  15. #ifndef HTPARSE_H
  16. #define HTPARSE_H
  17.  
  18. /*
  19.  
  20.    The following are flag bits which may be ORed together to form a number to give the
  21.    'wanted' argument to HTParse.
  22.  
  23.  */
  24. #define PARSE_ACCESS            16
  25. #define PARSE_HOST               8
  26. #define PARSE_PATH               4
  27. #define PARSE_ANCHOR             2
  28. #define PARSE_PUNCTUATION        1
  29. #define PARSE_ALL               31
  30.  
  31.  
  32. /*
  33.  
  34.    HTParse:  Parse a URL relative to another URL
  35.  
  36.    This returns those parts of a name which are given (and requested) substituting bits
  37.    from the related name where necessary.
  38.  
  39.    ON ENTRY
  40.  
  41.    aName                   A filename given
  42.  
  43.    relatedName             A name relative to which aName is to be parsed
  44.  
  45.    wanted                  A mask for the bits which are wanted.
  46.  
  47.    ON EXIT,
  48.  
  49.    returns                 A pointer to a malloc'd string which MUST BE FREED
  50.  
  51.  */
  52.  
  53. extern char *HTParse(const char *aName, const char *relatedName, int wanted);
  54.  
  55.  
  56. /*
  57.  
  58.    HTStrip: Strip white space off a string
  59.  
  60.    ON EXIT
  61.  
  62.    Return value points to first non-white character, or to 0 if none.
  63.  
  64.    All trailing white space is OVERWRITTEN with zero.
  65.  
  66.  */
  67. extern char *HTStrip(char *s);
  68.  
  69. /*
  70.  
  71.    HTSimplify: Simplify a UTL
  72.  
  73.    A URL is allowed to contain the seqeunce xxx/../ which may be replaced by "" , and the
  74.    seqeunce "/./" which may be replaced by "/". Simplification helps us recognize
  75.    duplicate filenames. It doesn't deal with soft links, though. The new (shorter)
  76.    filename overwrites the old.
  77.  
  78.  */
  79. /*
  80.    **      Thus,   /etc/junk/../fred       becomes /etc/fred
  81.    **              /etc/junk/./fred        becomes /etc/junk/fred
  82.  */
  83. extern void HTSimplify(char *filename);
  84.  
  85.  
  86. /*
  87.  
  88.    HTEscape:  Encode unacceptable characters in string
  89.  
  90.    This funtion takes a string containing any sequence of ASCII characters, and returns a
  91.    malloced string containing the same infromation but with all "unacceptable" characters
  92.    represented in the form %xy where X and Y are two hex digits.
  93.  
  94.  */
  95. extern char *HTEscape(CONST char *str, unsigned char mask, char protect);
  96.  
  97. /*
  98.  
  99.    The following are valid mask values. The terms are the BNF names in the URL document.
  100.  
  101.  */
  102. #define URL_XALPHAS     (unsigned char) 1
  103. #define URL_XPALPHAS    (unsigned char) 2
  104. #define URL_PATH        (unsigned char) 4
  105.  
  106.  
  107. /*
  108.  
  109.    HTUnEscape: Decode %xx escaped characters
  110.  
  111.    This function takes a pointer to a string in which character smay have been encoded in
  112.    %xy form, where xy is the acsii hex code for character 16x+y. The string is converted
  113.    in place, as it will never grow.
  114.  
  115.  */
  116. extern char *HTUnEscape(char *str);
  117.  
  118.  
  119. #endif /* HTPARSE_H */
  120.  
  121.  
  122. /*
  123.  
  124.    end of HTParse
  125.  
  126.  */
  127.